import * as util from '../common/util.js'

function getAjax(url, request, callback) {

	util.getAjax(url, request, function(data) {
		let code = JSON.stringify(data.code)
		if (code == 200) {
			callback(data);
		} else if (code == 411) {
			let lang = uni.getStorageSync('lang')
			uni.removeStorageSync('loginInfo')
			uni.reLaunch({
				url: '/pages/index/index'
			})
			uni.showToast({
				icon: 'none',
				title: data.msg
			})
		} else {
			// callback(data);
			uni.showToast({
				icon: 'none',
				title: data.msg
			})
		}
	});

}

export default getAjax;